package com.hk.enums;

import lombok.Data;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

@Getter
public enum SexEnum {

    MALE("男",0),
    FEMALE("女",1)
    ;

    private String desc;

    private Integer code;


    public static SexEnum getSexByCode(Integer code) {
        if (Objects.isNull(code)) return null;
        SexEnum[] sexEnums = values();
        for (SexEnum anEnum : sexEnums) {
            if (anEnum.getCode().equals(code)) {
                return anEnum;
            }
        }
        return null;
    }

    SexEnum(String desc, Integer code) {
        this.desc = desc;
        this.code = code;
    }


}
